from nodetypes.formats.mml.Events import EventHandler

from myelin.server.lib.http import ParamValidators
from myelin.server.lib.http import Status

from forms import Reset

class EventHandler(EventHandler):
                
    newResetForm       = Reset.Form    
            
    def process(self, context, source):
        eventData = context.event.data
        
        if context.account.isLoggedIn():
            eventData.status_type = u'logged-in'
            
        eventData.form = self.newResetForm()        
        eventData.status = u'success'
        eventData.stage = 0
        eventData.submits = context.transform.submitEvents[0]
        
        context.model = context.nodeType.retrieveModel(context)
        
        return self.newDocument().createDocument(context, source)